package com.lzx.iteam.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.lzx.iteam.R;

/**
 * Created by liukun on 15-1-25.
 */
public class TextMoreView extends FrameLayout {
    private TextView mTvDesc;
    private ImageView mIvMore,mIvImage;

    public TextMoreView(Context context,AttributeSet attrs){
        super(context,attrs);
        LayoutInflater.from(context).inflate(R.layout.text_more_layout, this);
        mTvDesc = (TextView) findViewById(R.id.text_more_desc);
        mIvMore = (ImageView) findViewById(R.id.iv_more);
        mIvImage = (ImageView) findViewById(R.id.iv_more_title);
        TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.TextMoreView);
        String desc = array.getString(R.styleable.TextMoreView_desc);
        Drawable drawable = array.getDrawable(R.styleable.TextMoreView_image);
        mTvDesc.setText(desc);
        mIvImage.setImageDrawable(drawable);
        array.recycle();
    }

    public void setDescText(String desc){
        mTvDesc.setText(desc);
    }

    public void setImage(Drawable drawable){
        mIvImage.setImageDrawable(drawable);
    }
    public void setImageGone(){
        mIvImage.setVisibility(GONE);
    }

}
